<%--
  Created by IntelliJ IDEA.
  User: CloudDreamRan
  Date: 2017/10/12
  Time: 13:38
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title></title>
</head>
<body>

<iframe id="iframe" src="https://www.cloudream.xin/s?wd=天泰志远"></iframe>
<%--<div id="load_div" style="height: 250px;width: 200px"></div>--%>
<script src="./static/js/jquery.min.js"></script>
<script>

  function traverseIframe() {
//    var document = $("#iframe").context;
    var doc = $(iframe.contentWindow.document);
    var row = $(doc).find('.t a');
    for (var i = 0; i < row.length; i++) {
      var text = row[i].innerHTML;
      if (text.indexOf('官网')>=0 && text.indexOf('天泰志远')>=0) {
//        a = row[i];
        iframe.src = row[i].href.replace("http:","https:");
//        location.href = row[i].href;
//        createIframe(row[i].href);
      }
    }
  }

  function createIframe(iframeUrl,i){
    var body = document.getElementsByTagName("body")[0];
    var iframe = document.createElement("iframe"+i);
//    iframe.style.display = "none";
    iframe.src = iframeUrl;
    body.appendChild(iframe);
  }

  function doGetCode(str) {
    var rtn = [];
    for (var i = 0; i < str.length; i++) {
      rtn.push(str.charCodeAt(i))
    }
    return rtn;
  }

  function deCode(str, sign){
    var arr = doGetCode(str);
    var rtn = '';
    for(var i=0;i<arr.length;i++){
//      arr[i]=arr[i]-sign;
      rtn+=String.fromCharCode(arr[i]-sign);
    }
    return rtn;
  }

  //utf8转字符串
  function getCharFromUtf8(str) {
    var cstr = "";
    var nOffset = 0;
    if (str == "")
      return "";
    str = str.toLowerCase();
    nOffset = str.indexOf("%e");
    if (nOffset == -1)
      return str;
    while (nOffset != -1) {
      cstr += str.substr(0, nOffset);
      str = str.substr(nOffset, str.length - nOffset);
      if (str == "" || str.length < 9)
        return cstr;
      cstr += utf8ToChar(str.substr(0, 9));
      str = str.substr(9, str.length - 9);
      nOffset = str.indexOf("%e");
    }
    return cstr + str;
  }

  //将编码转换成字符
  function utf8ToChar(str) {
    var iCode, iCode1, iCode2;
    iCode = parseInt("0x" + str.substr(1, 2));
    iCode1 = parseInt("0x" + str.substr(4, 2));
    iCode2 = parseInt("0x" + str.substr(7, 2));
    return String.fromCharCode(((iCode & 0x0F) << 12) | ((iCode1 & 0x3F) << 6) | (iCode2 & 0x3F));
  }
</script>
</body>
</html>
